import Misc from './Misc';

export default class Validator {
  static specialChars = '@$!%*?&()[]:-_';
  static passwordRegExp = Misc.createRegExp`
    ^(?=.*[a-z])
    (?=.*[A-Z])
    (?=.*\d)
    (?=.*[${Validator.specialChars}])
    [A-Za-z\d${Validator.specialChars}]{8,}$
  `;

  static checkPassword = (password: string): boolean => {
    if (!Validator.passwordRegExp.test(password)) { return false; }
    return true;
  };
}
